package com.jeeplus.test.jlnu.changeStuInfo.mapper;

import com.jeeplus.test.jlnu.changeStuInfo.domain.entity.ChangeStuInfoHistory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ChangeAuditMapper {

    int insert(List<ChangeStuInfoHistory> audits);

    int update(ChangeStuInfoHistory audit);

    int updateByStudentId(ChangeStuInfoHistory audit);

    @Select("SELECT * FROM change_audit WHERE student_id=#{studentId} ORDER BY change_date DESC")
    List<ChangeStuInfoHistory> selectByStudentId(String studentId);

    ChangeStuInfoHistory selectById(Integer id);

    int countByIdAndState(ChangeStuInfoHistory changeStuInfoHistory);

    void batchUpdateHistoryStatus(@Param("approveState") Integer status, @Param("historyIds") List<Long> historyIds);

    int countByStudentIdAndStates(@Param("studentId") String studentId, @Param("states") List<Integer> states);

    List<ChangeStuInfoHistory> selectByStudentIdAndStates(@Param("studentId") String studentId,@Param("states") List<Integer> states);

    List<ChangeStuInfoHistory> groupingByInfoId(Long infoId);
}
